//
//  PostsListTitleView.m
//  JiaoX
//
//  Created by yinqy on 15/3/4.
//  Copyright (c) 2015年 北京娇羞科技有限公司. All rights reserved.
//

#import "PostsListTitleView.h"
#define kImageViewhHeight [DimensUtils getScaleX:60]

@interface PostsListTitleView()
@property (nonatomic,weak)UIImageView *imageView;
@property (nonatomic,weak)UILabel *label;
@end
@implementation PostsListTitleView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setBackgroundColor:[UIColor whiteColor]];
        
        UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 5, kImageViewhHeight, kImageViewhHeight)];
        self.imageView = imageView;
        [self addSubview:imageView];
        
        UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(imageView.frame)+5, 5, JXScreenW-CGRectGetMaxX(imageView.frame)-15, imageView.height)];
        [label setTextColor:JXColor(102, 102, 102)];
        [label setNumberOfLines:2];
        [label setFont:[UIFont systemFontOfSize:[DimensUtils getScaleX:13]]];
        [self addSubview:label];
        self.label = label;
        
        UIView *splite = [[UIView alloc]initWithFrame:CGRectMake(0,CGRectGetMaxY(imageView.frame)+5,JXScreenW,10)];
        [splite setBackgroundColor:JXColor(238,238,238)];
        [self addSubview:splite];
        
        [self setSize:CGSizeMake(JXScreenW,CGRectGetMaxY(splite.frame))];
    }
    return self;
}

-(void)setModel:(BBSModel *)model{
    _model = model;
    [self.imageView sd_setImageWithURL:[NSURL URLWithString:model.icon]];
    [self.label setText:model.modelDesc];
    
    
}
@end
